package com.quoo.struts2.action;

import org.hibernate.Query;
import org.hibernate.Session;

import com.opensymphony.xwork2.ActionSupport;
import com.quoo.struts2.service.UserService;

public class LoginAction extends ActionSupport {
	private String username;
	private String password;
	private UserService service;
	
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	
	public UserService getService() {
		return service;
	}
	public void setService(UserService service) {
		this.service = service;
	}
	@Override
	public String execute() throws Exception {
		Boolean auth = this.service.validate(username, password);
		if(auth ==true){
			return SUCCESS;
		}
		else{
			return INPUT;
		}
	
	}
}
